const mysql = require('mysql2/promise');

const pool = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: 'root',
  database: 'time_tracker',
  waitForConnections: true,
  connectionLimit: 10
});

module.exports = {
  async query(sql, params) {
    const [rows] = await pool.query(sql, params);
    return rows;
  }
};